//
//  LoginViewController.m
//  Mall
//
//  Created by 孙飞燕 on 16/10/18.
//  Copyright © 2016年 孙飞燕. All rights reserved.
//

#import "LoginViewController.h"
@interface LoginViewController ()

@property (nonatomic,strong)UILabel *accountLabel; //账号
@property (nonatomic,strong)UITextField *accountTF;
@property (nonatomic,strong)UILabel *passwordLabel;//密码
@property (nonatomic,strong)UITextField *passwordTF;
@property (nonatomic,strong)UIButton *loginBtn; //登录
@property (nonatomic,strong)UIButton *registerBtn;//注册
@property (nonatomic,strong)UIButton *findPasswordBtn; //找回密码
@end

@implementation LoginViewController
- (UILabel *)accountLabel{
    if (!_accountLabel) {
        _accountLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 100, 50, 30)];
        _accountLabel.text = @"账户:";

    }
    return _accountLabel;
}

- (UITextField *)accountTF{
    if (!_accountTF) {
        _accountTF = [[UITextField alloc]initWithFrame:CGRectMake(80, 100, 150, 30)];
        _accountTF.placeholder = @"请输入手机号码";
        [self.view addSubview:_accountTF];

    }
    return _accountTF;
}
- (UILabel *)passwordLabel{
    if (!_passwordLabel) {
        _passwordLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 150, 80, 30)];
        _passwordLabel.text = @"密码:";
        [self.view addSubview:_passwordLabel];

    }
    return _passwordLabel;
}

- (UITextField *)passwordTF{
    if (!_passwordTF) {
        _passwordTF = [[UITextField alloc]initWithFrame:CGRectMake(80, 150, 100, 30)];
        _passwordTF.placeholder = @"请输入密码";
        [self.view addSubview:_passwordTF];

    }
    return _passwordTF;
}

- (UIButton *)loginBtn{
    if (!_loginBtn) {
        _loginBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        _loginBtn.frame = CGRectMake(10, 200, kWidth - 20 , 40);
        [_loginBtn addTarget:self action:@selector(loginAction:) forControlEvents:UIControlEventTouchUpInside];
        [_loginBtn setTitle:@"登录" forState:UIControlStateNormal];
        _loginBtn.tintColor = [UIColor whiteColor];
        _loginBtn.backgroundColor = [UIColor redColor];
        [self.view addSubview:_loginBtn];

    }
    return _loginBtn;
}
- (UIButton *)registerBtn{
    if (!_registerBtn) {
        _registerBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        _registerBtn.frame = CGRectMake(10, 250, 100, 30);
        [_registerBtn addTarget:self action:@selector(registerAction:) forControlEvents:UIControlEventTouchUpInside];
        [_registerBtn setTitle:@"快速注册" forState:UIControlStateNormal];
        _registerBtn.tintColor = [UIColor lightGrayColor];

    }
    return _registerBtn;
}

- (UIButton *)findPasswordBtn{
    if (!_findPasswordBtn) {
        _findPasswordBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        _findPasswordBtn.frame = CGRectMake(kWidth - 100, 250, 100, 30);
        [_findPasswordBtn addTarget:self action:@selector(findPasswordAction:) forControlEvents:UIControlEventTouchUpInside];
        [_findPasswordBtn setTitle:@"找回密码" forState:UIControlStateNormal];
        _findPasswordBtn.tintColor = [UIColor lightGrayColor];

    }
    return _findPasswordBtn;
}
//登录事件
- (void)loginAction:(UIButton *)sender{
    PersonalCenterViewController *pcVC = [[PersonalCenterViewController alloc]init];
    [self.navigationController pushViewController:pcVC animated:YES];
}
//注册事件
- (void)registerAction:(UIButton *)sender{
    RegisterViewController *registerVC = [[RegisterViewController alloc]init];
    [self.navigationController pushViewController:registerVC animated:YES];
}

//找回密码
- (void)findPasswordAction:(UIButton *)sender{

}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.view addSubview:self.accountLabel];
    [self.view addSubview:self.accountTF];
    [self.view addSubview:self.passwordLabel];
    [self.view addSubview:self.passwordTF];
    [self.view addSubview:self.loginBtn];
    [self.view addSubview:self.registerBtn];
    [self.view addSubview:self.findPasswordBtn];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
